﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.Infrastructure;
using TaxiOnline.DAL.Models;

namespace TaxiOnline.DAL.DataLayers
{
    public class TaxiContext : DbContext
    {
        public DbSet<Address> Addresses { get; set; }
        public DbSet<City> Cities { get; set; }
        public DbSet<Region> Regions { get; set; }
        public DbSet<Street> Streets { get; set; }
        public DbSet<DeliveryOrder> DeliveryOrders { get; set; }
        public DbSet<FastOrder> FastOrders { get; set; }
        public DbSet<TaxiOrder> TaxiOrders { get; set; }
        public DbSet<OrderState> OrderStates { get; set; }
        public DbSet<User> Users { get; set; }
        public DbSet<Driver> Drivers { get; set; }
        public DbSet<Vehicle> Vehicles { get; set; }
        public DbSet<TypeOfVehicle> TypesOfVehicle { get; set; }

        public TaxiContext(string connection):base(connection)
        {

        }

        //protected override void OnModelCreating(DbModelBuilder modelBuilder)
        //{
        //    modelBuilder.Entity<Region>().
        //      HasMany(r => r.Streets).
        //      WithMany(p => p.Region).
        //      Map(
        //       m =>
        //       {
        //           m.MapLeftKey("RegionId");
        //           m.MapRightKey("StreetId");
        //           m.ToTable("StreetInRegion");
        //       });
        //}

    }
}
